{*

/**
 * eggsurplus: photo
 */

*}
{include file="modules/DynamicFields/templates/Fields/Forms/coreTop.tpl"}

<tr>
	<td class='mbLBL'>{$APP.LBL_PHOTO_FIXED_DIMENSION}:</td>
	<td>
		{literal}
		<script>
		function forceRange(field, min, max){
			field.value = parseInt(field.value);
			if(field.value == 'NaN')field.value = max;
			if(field.value > max) field.value = max;
			if(field.value < min) field.value = min;
		}
		function toggleDimensions(field){
			if(field.checked) {
				document.getElementById('ext3').disabled = false;
				document.getElementById('ext4').disabled = false;
			} else {
				document.getElementById('ext3').disabled = true;
				document.getElementById('ext4').disabled = true;
			}
		}
		</script>
		{/literal}
		<input type="checkbox" name="ext2" id="ext2" value="1" {if !empty($vardef.ext2)}checked{/if} onclick="toggleDimensions(this);">
	</td>
</tr>
<tr>
	<td class='mbLBL'>{$APP.LBL_PHOTO_WIDTH}:</td>
	<td>
		<input type="text" {if empty($vardef.ext2)}disabled="false"{/if} name="ext3" id="ext3" value="{$vardef.ext3}" onchange="forceRange(this,1,1024);">
	</td>
</tr>
<tr>
	<td class='mbLBL'>{$APP.LBL_PHOTO_HEIGHT}:</td>
	<td>
		<input type="text" {if empty($vardef.ext2)}disabled="false"{/if} name="ext4" id="ext4" value="{$vardef.ext4}" onchange="forceRange(this,1,1024);">
	</td>
</tr>
